********************************************************
*Replication code for 
/*		
		Are Ideological and Partisan Affinities Determining Voters' Support of Arms Deliveries? 
		Insights from a Large-scale Survey Experiment in France and Germany 
		
		Lukas Rudolph (University of Konstanz, lukas.rudolph@uni-konstanz.de) and Paul Thurner (LMU Munich)
		
		European Political Science Review
		
		2024
*/
********************************************************


********************************************************
*generated: 2024-05-16
*
*by Lukas Rudolph
*
*modified: -- (v1)
*
*Data used:  rudolph_thurner_2024_epsr.dta
*Data output generated: --
*Tables generated: Table A.3-A.6
*Figures generated: Figure 1-7; Figure A.2-A.5
********************************************************


********************************************************
*prepare Stata
********************************************************

*set working directory path to where folder "rep_files_epsr" containing the dataset is placed
// cd "" // enter parth into ""

*set stata version
version 16

*load packages -- uncomment the below, if not already installed
/*
ssc install estout // estout package by Benn Jann
ssc install coefplot // coefplot package by Benn Jann
ssc install grstyle // grstyle package by Benn Jann
ssc install palettes // palettes package by Benn Jann
ssc install colrspace // colrspace package by Benn Jann
ssc install mplotoffset // mplotoffset package by Nicholas Winter
*/

*set path for saving figures and tables
global tab = "rep_files_epsr\"
global fig = "rep_files_epsr\"

*set grstyle for nice figures
grstyle init
grstyle set imesh,         
grstyle set symbol
grstyle set color plottig  
grstyle set legend, nobox


********************************************************
*load data
********************************************************

use "rep_files_epsr\rudolph_thurner_2024_epsr.dta", clear


****************************************************************************************************************
*GENERAL RECODING OF DATASET
****************************************************************************************************************

**** left-right scale: trichotomous indicator

recode Q14 (1/5 = 1 "Left") (6=2 "Center") (7/11 = 3 "Right"), gen(leftright)


**** set party ID variable labels

/* FRANCE
1	Rassemblement national
2	La République en marche
3	Europe Ecologie - Les Verts
4	Les Républicains
5	La France insoumise de Jean-Luc Mélenchon
6	Parti socialiste
7	Debout la France
8	Parti communiste français
*/
/* GERMANY
1	CDU/CSU
2	SPD
3	Grüne
4	DIE LINKE
5	FDP
6	AfD
*/
gen Q13_de = Q13 if hCountry == 1
gen Q13_fr = Q13_FR if hCountry == 2

label define party_de 1 Union 2	SPD 3	Greens 4	Left 5	FDP 6 AfD 7 other 8 NA, replace
label values Q13_de party_de 
 
label define party_fr 1 RN 2	Marche 3	Greens 4	Rep 5	insoumis 6 PS 7 Debout 8 Communiste 9 other 10 NA, replace
label values Q13_fr party_fr
 
**** generate indicator for party in party display vignette matching respondent Party ID
gen partymatch = 0 if PARTEI <= 6 | PARTEI_FR <= 8
replace partymatch = 1 if ParteDisplay_DE == PARTEI & hCountry==1 & PARTEI <= 6
replace partymatch = 1 if ParteDisplay_FR == PARTEI_FR & hCountry==2 & PARTEI_FR <= 8

**** generate categorical variable for which party preferred by respondent (if not other/missing)

gen preferred_party = 0
replace preferred_party = 1 if ParteDisplay_DE == Q13 & Q13 < 7
replace preferred_party = 1 if ParteDisplay_FR == Q13_FR & Q13_FR < 9
label variable preferred_party "PID party of respondent"

*** arms trade vignette recoding and labeling (note: data is in long form due to multiple conjoint rounds. hence code vignette only once per respondent -> if CH=="CH1" & CJ == "CJ1")

*recode vignette choice outcome to 0/1
recode Q17 (2=0) (1=1) if CH=="CH1" & CJ == "CJ1", gen(v_choice)
label variable v_choice "Vignette decision"

*set vignette condition labels
recode VIGNETTE (1 5 = 2 "high value, autocracy") (2 6 = 1 "low value, autocracy") (3 7 = 4 "high value, democracy") (4 8 = 3 "low value, democracy") if CH=="CH1" & CJ == "CJ1", gen(treat)

*generate vignette condition indicators and their interaction
gen democracy = (treat==3 | treat == 4) if CH=="CH1" & CJ == "CJ1"
gen highvalue =  (treat==2 | treat == 4) if CH=="CH1" & CJ == "CJ1"
label variable democracy "Democracy"
label variable highvalue "High economic value"

gen interact = democracy*highvalue
label variable interact "Democracy # high economic value"

*** recode and label arms trade mechanism questions 

replace Q19r4 = 8 - Q19r4  // reverse items with opposite scale direction
replace Q19r5 = 8 - Q19r5  // reverse items with opposite scale direction

label variable Q19r1 "morally wrong"
label variable Q19r2 "bad for own country security"
label variable Q19r3 "bad for world security"
label variable Q19r4  "good for own country people"
label variable Q19r5  "good for recipient country people"

*** label conjoint choice outcome
label variable y "Conjoint choice"


****************************************************************************************************************
*MAIN ARTICLE FIGURES 
****************************************************************************************************************

********************************************************
* FIGURE 1

reg v_choice i.democracy##i.highvalue##i.leftright, r
margins, over(i.democracy i.highvalue i.leftright) post
mplotoffset, offset(0.45)  recast(scatter)   by(leftright) byopts(row(1) title("")) ylabel(0(.1).8) ///ymtick(#2, grid) 
legend( size(*0.85) order(3 "Low economic value" 4 "High economic value"))   xlabel(0 "Autocracy" 1 "Democracy") ytitle("Proportion of agreement") xtitle("")
graph export "$fig\figure01.eps", replace


********************************************************
* FIGURE 2

foreach x of varlist Q19r? {
reg `x' i.democracy i.highvalue , r // 
  eststo `x': margins i.democracy i.highvalue, post // 
}

foreach x of varlist Q19r? {
  reg `x' i.democracy i.highvalue if leftright == 1 , r // 
 eststo left`x':  margins i.democracy i.highvalue, post // 
}
 
 foreach x of varlist Q19r? {
   reg `x' i.democracy i.highvalue if leftright == 2 , r // 
eststo center`x': margins i.democracy i.highvalue, post // 
}

foreach x of varlist Q19r? {
reg `x' i.democracy i.highvalue if leftright == 3, r // 
  eststo right`x': margins i.democracy i.highvalue, post // 
}

coefplot  *Q19r1  , bylabel("Morally wrong") || *Q19r2 , bylabel("Bad for own country security") || *Q19r3  , bylabel("Bad for world security") || *Q19r4  , bylabel("Bad for own country people" ) || *Q19r5 , bylabel("Bad for recipient country people")   ///
   keep(*demo* *high*  ) xline(0, lpattern(solid))  byopts( cols(1) )  xsize(1) ysize(1.5) xlabel(3(1)6 ,  grid) xmtick(#2, grid) ///
   grid( glstyle(minor_grid) glcolor(gray)) ytick(2.5, notick glstyle(refline) glpattern(dash) glcolor(gs9)) /// 
legend(size(small) region(lcolor(white)) order(2 "All" 4 "Left" 6 "Center" 8 "Right") cols(4))  base order(*democracy *highvalue) ///
levels(95) ylabel(1 "Autocracy" 2 "Democracy" 3 "Low value" 4 "High value")
 
graph export "$fig\figure02.eps", replace

********************************************************
* FIGURE 3

eststo clear
reg y i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9 if leftright==1 , cluster(uuid)
eststo left: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9 , post
reg y i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9 if leftright==3 , cluster(uuid)
eststo right: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9, post

coefplot left right, drop(_cons)  yline(2.5 5.5 10.5 13.5 16.5 19.5 21.5 25.5, lcol(grey) lsty(pattern(dash) )) ///   
 msize(small)  name(one, replace) ylabel(,labsize(vsmall)) xlabel(,labsize(vsmall)) /// 
groups(?.ATT1 ?.ATT2 ?.ATT3  = `""{bf:Normative}" "{bf:dimension}""'        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = `""{bf:Economic}" "{bf:dimension}""' ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  `""{bf:Contextual}" "{bf:factors}""', labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:Form of government}"                ///
            1.ATT2 = "{it:Human rights situation}" /// 
			1.ATT3 = "{it:Conflict situation}" /// /// 
			1.ATT6 = "{it:Economic value}" /// /// 
			1.ATT7 = "{it:Jobs}" /// /// 
			1.ATT5 = "{it:Trade partnership}" /// /// 
			1.ATT4 = "{it:Security partnership}" /// /// 
			1.ATT8 = "{it:Weapon type}" /// /// 
			1.ATT9 = "{it:Trade of other countries}" /// /// 
			, labsize(vsmall)) 
			

coefplot left right, drop(_cons)  yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey))legend(row(1) symysize(vsmall) size(vsmall))  ///  
 msize(small)  name(one, replace) ylabel(,labsize(vsmall)) xlabel(,labsize(vsmall)) /// 
groups(?.ATT1 ?.ATT2 ?.ATT3  = `""{bf:Normative}" "{bf:dimension}""'        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = `""{bf:Economic}" "{bf:dimension}""' ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  `""{bf:Contextual}" "{bf:factors}""', labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:Form of government}"                ///
            1.ATT2 = "{it:Human rights situation}" /// 
			1.ATT3 = "{it:Conflict situation}" /// /// 
			1.ATT6 = "{it:Economic value}" /// /// 
			1.ATT7 = "{it:Jobs}" /// /// 
			1.ATT5 = "{it:Trade partnership}" /// /// 
			1.ATT4 = "{it:Security partnership}" /// /// 
			1.ATT8 = "{it:Weapon type}" /// /// 
			1.ATT9 = "{it:Trade of other countries}" /// /// 
			, labsize(vsmall)) 
						

reg y i.ATT? i.leftright (i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9)#i.leftright if leftright!=2, cluster(uuid)
eststo byideology: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9 , dydx(leftright) post

coefplot byideology,  nolabel name(two, replace) title("")  legend(on order(2 "right - left")) ylabel("") yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey)) xline(0)  fxsize(20) msize(small) xlabel(,labsize(small)) legend(row(1) symysize(vsmall) size(vsmall)) xlabel(,labsize(vsmall)) ///
groups(?.ATT1 ?.ATT2 ?.ATT3  = "{bf:}"        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = "{bf:}" ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  "{bf:}", labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:}"                ///
            1.ATT2 = "{it:}" /// 
			1.ATT3 = "{it:}" /// /// 
			1.ATT6 = "{it:}" /// /// 
			1.ATT7 = "{it:}" /// /// 
			1.ATT5 = "{it:}" /// /// 
			1.ATT4 = "{it:}" /// /// 
			1.ATT8 = "{it:}" /// /// 
			1.ATT9 = "{it:}" /// /// 
			, labsize(vsmall)) 

graph combine one two , cols(2)

graph export "$fig\figure03.eps", replace


********************************************************
* FIGURE 4

eststo clear

eststo Pooled: reg v_choice democracy highvalue if hCountry==1, r
foreach x in 1 2 3 4 5 6   {
if `x' == 1 	local label = "Union"
else if `x' == 2 local label = "SPD"
else if `x' == 3 local label = "Greens"
else if `x' == 4 local label = "Left"
else if `x' == 5 local label = "FDP"
else if `x' == 6 local label = "AfD"
eststo `label': reg v_choice democracy highvalue if party_choice_de == `x', r
}

coefplot Pooled Left  Greens SPD FDP Union  AfD, levels( 95 90) legend(cols(4)) label   coeflabels( _cons = "Constant", wrap(20)) xline(0)  
graph export "$fig\figure04.eps", replace


********************************************************
* FIGURE 5
grstyle init
grstyle set imesh,         
grstyle set symbol
grstyle set color plottig 
grstyle set legend, nobox

eststo clear

eststo Pooled: reg v_choice democracy highvalue if hCountry==2, r
foreach x in 1 2 3 4 5 6 7 8  {
if `x' == 1 	local label = "RN"
else if `x' == 2 local label = "Marche"
else if `x' == 3 local label = "Greens"
else if `x' == 4 local label = "Rep"
else if `x' == 5 local label = "Insoumise"
else if `x' == 6 local label = "PS"
else if `x' == 7 local label = "Debout"
else if `x' == 8 local label = "PCF"
eststo `label': reg v_choice democracy highvalue if party_choice_fr == `x', r
}

*leaves out debout and pcf 
coefplot Pooled Insoumise PS   Greens Marche   RN Rep  , levels( 95 90) legend(cols(4)) label   coeflabels( _cons = "Constant", wrap(20)) xline(0)
graph export "$fig\figure05.eps", replace


********************************************************
* FIGURE 6

eststo clear
foreach x in 4 3  2   5 1 6 {
	if `x' == 1 	local label = "Union"
else if `x' == 2 local label = "SPD"
else if `x' == 3 local label = "Greens"
else if `x' == 4 local label = "Left"
else if `x' == 5 local label = "FDP"
else if `x' == 6 local label = "AfD"
eststo `label': reg Q20A preferred_party if hCountry==1 & ParteDisplay_DE == `x' & CH=="CH1" & CJ == "CJ1"  // DE
eststo policyimportance`label': reg Q20B preferred_party  if hCountry==1 & ParteDisplay_DE == `x' & CH=="CH1" & CJ == "CJ1" // DE
}

coefplot Left Greens SPD FDP Union AfD , bylabel("Perceived issue position of party") || policyimportanceLeft  policyimportanceGreens policyimportanceSPD policyimportanceFDP policyimportanceUnion  policyimportanceAfD, bylabel("Importance of party policy for voting")    levels( 95 ) legend(size(small) rows(1) ) xmtick(#2, grid) xlabel(-1(1)5) coeflabels( _cons = "Constant", wrap(20)) xline(0)

graph export "$fig\figure06.eps", replace


********************************************************
* FIGURE 7

eststo clear
foreach x in 5 6  3 2  1 4 {
if `x' == 1 	local label = "RN"
else if `x' == 2 local label = "Marche"
else if `x' == 3 local label = "Greens"
else if `x' == 4 local label = "Rep"
else if `x' == 5 local label = "Insoumise"
else if `x' == 6 local label = "PS"
eststo `label': reg Q20A preferred_party if hCountry==2 & ParteDisplay_FR == `x' & CH=="CH1" & CJ == "CJ1"  // DE
eststo policyimportance`label': reg Q20B preferred_party  if hCountry==2 & ParteDisplay_FR == `x' & CH=="CH1" & CJ == "CJ1" // DE
}

coefplot Insoumise PS  Greens Marche RN Rep, bylabel("Perceived issue position of party") || policyimportanceInsoumise policyimportancePS  policyimportanceGreens policyimportanceMarche policyimportanceRN policyimportanceRep  , bylabel("Importance of party policy for voting")   xline(0) levels( 95 ) legend(size(small) rows(1)) xmtick(#2, grid) xlabel(-1(1)5) coeflabels( _cons = "Constant", wrap(20)) xline(0)

graph export "$fig\figure07.eps", replace


********************************************************************************************************************************
*APPENDIX FIGURES AND TABLES 
********************************************************************************************************************************

********************************************************
* APPENDIX FIGURE 2 

eststo clear


foreach x in 1 2 3     {
eststo reg`x': reg v_choice democracy highvalue interact if leftright == `x' , r
}

coefplot reg1 reg2 reg3, legend(on cols(3) order(3 "Left" 6 "Center" 9 "Right")) levels(95 90 ) label   coeflabels( _cons = "Constant", wrap(20)) xline(0)  

graph export "$fig\figureA02.eps", replace


********************************************************
* APPENDIX FIGURE 3 

grstyle init
grstyle set imesh,         
grstyle set symbol
grstyle set lpattern
grstyle set color plottig 
grstyle set legend, nobox


reg v_choice ib2.treat##c.Q14##c.Q14##c.Q14 if CH=="CH1" & CJ=="CJ1"  , r  

margins , over(treat) at(Q14 = (1(1)11)) post

marginsplot,    recast(line) recastci(rarea)  ciopt(color(%20)) xtitle("")  title("Vignette by ideology")
graph export "$fig\figureA03.eps", replace


********************************************************
* APPENDIX FIGURE 4

grstyle init
grstyle set imesh,         
grstyle set symbol
grstyle set color plottig 
grstyle set legend, nobox


foreach x of varlist Q19r? {
  eststo `x': reg `x' i.democracy i.highvalue , r // 
}

foreach x of varlist Q19r? {
  eststo left`x': reg `x' i.democracy i.highvalue if leftright == 1 , r // 
}
 
 foreach x of varlist Q19r? {
  eststo center`x': reg `x' i.democracy i.highvalue if leftright == 2 , r // 
}

foreach x of varlist Q19r? {
  eststo right`x': reg `x' i.democracy i.highvalue if leftright == 3, r // 
}
 

coefplot  *Q19r1  , bylabel("Morally wrong") || *Q19r2 , bylabel("Bad for own country security") || *Q19r3  , bylabel("Bad for world security") || *Q19r4  , bylabel("Bad for own country people" ) || *Q19r5 , bylabel("Bad for recipient country people")   ///
   keep(*demo* *high*  ) xline(0, lpattern(solid))  byopts(cols(1) )  xsize(1) ysize(1.5) xlabel(-1.8(.3)0,  grid) ///
     ytick(2.5, notick glstyle(refline) glpattern(dash) glcolor(gs9)) /// 
legend(size(small) region(lcolor(white)) order(3 "All" 6 "Left" 9 "Center" 12 "Right") cols(4))  base order(*democracy *highvalue) ///
levels(95 90 ) ylabel(1 "Autocracy" 2 "Democracy" 3 "Low value" 4 "High value")

graph export "$fig\figureA04.eps", replace


********************************************************
* APPENDIX FIGURE 5

eststo clear
reg y i.ATT?  if leftright==1 , cluster(uuid)
eststo left: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9, post
reg y i.ATT?  if leftright==2 , cluster(uuid)
eststo center: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9, post
reg y i.ATT?  if leftright==3 , cluster(uuid)
eststo right: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9, post

coefplot left center right, drop(_cons)  yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey))legend(row(1) symysize(vsmall) size(vsmall))  ///  
 msize(small)  name(one, replace) ylabel(,labsize(vsmall)) xlabel(,labsize(vsmall)) /// 
groups(?.ATT1 ?.ATT2 ?.ATT3  = `""{bf:Normative}" "{bf:dimension}""'        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = `""{bf:Economic}" "{bf:dimension}""' ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  `""{bf:Contextual}" "{bf:factors}""', labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:Form of government}"                ///
            1.ATT2 = "{it:Human rights situation}" /// 
			1.ATT3 = "{it:Conflict situation}" /// /// 
			1.ATT6 = "{it:Economic value}" /// /// 
			1.ATT7 = "{it:Jobs}" /// /// 
			1.ATT5 = "{it:Trade partnership}" /// /// 
			1.ATT4 = "{it:Security partnership}" /// /// 
			1.ATT8 = "{it:Weapon type}" /// /// 
			1.ATT9 = "{it:Trade of other countries}" /// /// 
			, labsize(vsmall)) 

reg y i.ATT?  i.leftright (i.ATT? )#i.leftright if leftright!=2, cluster(uuid)
eststo comprl: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9 , dydx(leftright) post

coefplot comprl,  nolabel name(two, replace) title("")  legend(on order(2 "right-left")) ylabel("") xlabel(-0.05 0 0.05) yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey)) xline(0)  fxsize(20) msize(small) xlabel(,labsize(small)) legend(row(1) symysize(vsmall) size(vsmall)) xlabel(,labsize(vsmall)) ///
groups(?.ATT1 ?.ATT2 ?.ATT3  = "{bf:}"        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = "{bf:}" ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  "{bf:}", labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:}"                ///
            1.ATT2 = "{it:}" /// 
			1.ATT3 = "{it:}" /// /// 
			1.ATT6 = "{it:}" /// /// 
			1.ATT7 = "{it:}" /// /// 
			1.ATT5 = "{it:}" /// /// 
			1.ATT4 = "{it:}" /// /// 
			1.ATT8 = "{it:}" /// /// 
			1.ATT9 = "{it:}" /// /// 
			, labsize(vsmall))  

reg y i.ATT?  i.leftright (i.ATT? )#i.leftright if leftright!=1, cluster(uuid)
eststo compcr: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9, dydx(leftright) post

coefplot compcr,  nolabel name(three, replace) title("")  legend(on order(2 "right-center")) ylabel("") xlabel(-0.05 0 0.05) yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey)) xline(0)  fxsize(20) msize(small) xlabel(,labsize(small)) legend(row(1) symysize(vsmall) size(vsmall)) xlabel(,labsize(vsmall)) ///
groups(?.ATT1 ?.ATT2 ?.ATT3  = "{bf:}"        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = "{bf:}" ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  "{bf:}", labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:}"                ///
            1.ATT2 = "{it:}" /// 
			1.ATT3 = "{it:}" /// /// 
			1.ATT6 = "{it:}" /// /// 
			1.ATT7 = "{it:}" /// /// 
			1.ATT5 = "{it:}" /// /// 
			1.ATT4 = "{it:}" /// /// 
			1.ATT8 = "{it:}" /// /// 
			1.ATT9 = "{it:}" /// /// 
			, labsize(vsmall))  

reg y i.ATT?  i.leftright (i.ATT? )#i.leftright if leftright!=3, cluster(uuid)
eststo compcl: margins i.ATT1 i.ATT2 i.ATT3 i.ATT6 i.ATT7 i.ATT5 i.ATT4   i.ATT8 i.ATT9  i.ATT8 i.ATT9 , dydx(leftright) post

coefplot compcl,  nolabel name(four, replace) title("")  legend(on order(2 "center-left")) ylabel("") xlabel(-0.05 0 0.05) yline(4.5 9.5 23.5 28.5 37.5 43.5, lsty(pattern(dot)) lcol(grey))  yline(17 33, lsty(pattern(dash) ) lcol(grey)) xline(0)  fxsize(20) msize(small) xlabel(,labsize(small)) legend(row(1) symysize(vsmall) size(vsmall)) xlabel(,labsize(vsmall)) ///
groups(?.ATT1 ?.ATT2 ?.ATT3  = "{bf:}"        ///
         ?.ATT6 ?.ATT7 ?.ATT5 = "{bf:}" ///
         ?.ATT4 ?.ATT8 ?.ATT9 =  "{bf:}", labsize(vsmall)) /// 
		 headings(1.ATT1 = "{it:}"                ///
            1.ATT2 = "{it:}" /// 
			1.ATT3 = "{it:}" /// /// 
			1.ATT6 = "{it:}" /// /// 
			1.ATT7 = "{it:}" /// /// 
			1.ATT5 = "{it:}" /// /// 
			1.ATT4 = "{it:}" /// /// 
			1.ATT8 = "{it:}" /// /// 
			1.ATT9 = "{it:}" /// /// 
			, labsize(vsmall))  


graph combine one two three four , cols(4) xsize(8)

graph export "$fig\figureA05.eps", replace


********************************************************
*Tab A.3 
********************************************************
*prep relevant indicators
gen highvalue_conjoint = ATT6 == 4 & ATT7 == 3 
gen lowvalue_conjoint = ATT6 == 1 & ATT7 == 1 
gen highnorms_conjoint = ATT1 == 1 & ATT2 == 1 
gen lownorms_conjoint = ATT1 == 2 & ATT2 == 3

*prep paired comparisons
gen pair_high_low_norms = .
replace pair_high_low_norms = 1 if  CH == "CH1" & ATT1 == 1 & ATT2 == 1 & ATT1[_n+1] == 2 & ATT2[_n+1] == 3
replace pair_high_low_norms = 1 if pair_high_low_norms[_n-1] == 1 & CH[_n-1] == "CH1"

gen pair_high_low_value = .
replace pair_high_low_value = 1 if  CH == "CH1" & ATT6 == 1 & ATT7 == 1 & ATT6[_n+1] == 4 & ATT7[_n+1] == 3
replace pair_high_low_value = 1 if pair_high_low_value[_n-1] == 1 & CH[_n-1] == "CH1"

*prep variable lables
label variable highnorms_conjoint "Democracy, human rights resp."
label variable highvalue_conjoint "1 bn. benefit, 5000 jobs"
label variable v_choice "Vignette decision" 
label variable y "Conjoint choice" 
label variable y_rating "Conjoint rating" 

*table
eststo clear

eststo: reg v_choice democracy highvalue if CH=="CH1" & CJ=="CJ1", r

eststo: reg y highnorms_conjoint if pair_high_low_norms == 1, cluster(uuid)
eststo: reg y highvalue_conjoint if pair_high_low_value == 1, cluster(uuid)

eststo: reg y_rating highnorms_conjoint if pair_high_low_norms == 1, cluster(uuid)
eststo: reg y_rating highvalue_conjoint if pair_high_low_value == 1, cluster(uuid)

esttab   using "$tab\tableA03.tex" ///
, stats(N r2, fmt(0 2)) noomitted nobase se rename(democracy highnorms_conjoint highvalue highvalue_conjoint ) label ///
replace star(+ 0.10 * 0.05 ** 0.01 *** 0.001)


********************************************************
*Tab A.4 
********************************************************

* indicator based on human coding

generate nonsensical = . 
#delimit ;
foreach x in 
1mq1fqvfcfbmtp9f
sqgqyd5cq56pwga1
kqn3vknjau2wexhs
ynet8vz85wy0y058
trxwmuxpddu1qtgf
hny2hp0tmd1197r4
q7dcpdfntnrmbsxs
ue18k84c5er4ub3u
2byh1s9z90hb721y
5tbznczgz0hc7y26
hx5rm82tkumb1cuh
qp0s0rna3t5ekx8w
xnzddznucp4t55md
6zckthxp7dc2n46x
pjhpbz7932ws7t9c
f49zsvzwc16y0nxb
jmud888a371hxvvv
sy6a4v3xnznhr8bh
pzunkju4zc36u459
nn7e09975dq15wj6
v5j0sg2nx98hvt9k
8jfp6p0p6tywmr4q
zr9b2whf1c3vm00w
xx0g1tq98cxxbq6e
wdfmgkbykpwn3uha
9zn7k4k5xx7awtec
2wdvtbec0dbh1e15
2kmpjjmd65t4tbnb
qf30g917q90pxrxx
3x143q8x1r48es9c
jfh1uzbmnsx01bwn
qffsuzvsfegmr0vy
djqt3caapnbehu57
pc9ue08df3b4hbee
92tkmwnpsbfkucgs
nb8z9nsp9srdujsk
phmfmmchmrfx1gpy
71eqx4mj0q3035ns
gmwchxfvwyescedv
ucw2f54nkfee043m
32uq4cs8c9qksm34
7fkc0n97nj44h8cj
zwzb4ttmgtvmuus2
bdk4x3ubsyd4wyvw
kteguqvretj83rg7
yx0pcjtxcy9m8wbp
q4d45p6bg88sa4y1
ksyp01su7ek3dakb
3xy41sb27vjmcbqq
sg90nmn6q49005n6
g9xjhk1pt2gs3weu
y27zqejs29prqdmc
pr21cub1duwzx30j
gzb19k5982wu998p
qp045tg0bw2b5qdt
yrphvjeu6xraz44u
9u260fc0mq65m1qw
y46zms34ck9j5yag
kcetbnbe820a9zj2
asc64xg2zw6ytqp9
{ ; 
replace nonsensical = 1 if uuid == "`x'" ; 
} ;
#delimit cr

** table 

eststo clear
eststo: reg v_choice democracy highvalue if CH=="CH1" & CJ=="CJ1", r
eststo: reg v_choice democracy highvalue if CH=="CH1" & CJ=="CJ1" & nonsensical != 1, r
eststo: reg y i.ATT?  , r
eststo: reg y i.ATT? if  nonsensical == 1, r
esttab  using "$tab\tableA04.tex" ///
, stats(N r2, fmt(0 2)) noomitted nobase se label ///
replace star(+ 0.10 * 0.05 ** 0.01 *** 0.001)



********************************************************
*Tab A.5 
********************************************************

tab party_choice_de ParteDisplay_DE if CH == "CH1" & CJ == "CJ1"

********************************************************
*Tab A.6 
********************************************************

tab party_choice_fr ParteDisplay_FR if CH == "CH1" & CJ == "CJ1"


************************************************************************************************************************************************
*END 
************************************************************************************************************************************************
